{% extends "main/base.html" %}
{% load static i18n %}
{% block title %}{% trans '添加服务记录' %}{% endblock %}
{% block this_css %}
<link rel="stylesheet" type="text/css" href="{% static 'flatlab/css/bootstrap-select.min.css' %}">
{% endblock %}
{% block content %}
<div class="col-lg-offset-2 col-lg-8">
    <div class="panel">
        <header class="panel-heading">
            {% trans "添加服务记录" %}
            {% if form.errors %}
            <p>{% trans "提交的数据有误,请认真检查!" %}</p>
            {% endif %}
        </header>
        <div class="panel-body">
            <form method="post" action="{{ request.path }}?next={{ request.GET.next }}" enctype="multipart/form-data" class="form-horizontal">{% csrf_token %}
                {{ form.non_field_errors }}
                {% if request.user.is_authenticated %}
                <input type="hidden" name="created_by" id="id_created_by" value="{{ request.user.id }}">
                {% endif %}
                <div class="form-group">
                    <div class="col-sm-2 control-label">{{ form.title.label_tag }}</div>
                    <div class="col-sm-5">{{ form.title }}{{ form.title.errors }}</div>
                    <div class="col-sm-2 control-label">{{ form.service_date.label_tag }}</div>
                    <div class="col-sm-3">{{ form.service_date }}{{ form.service_date.errors }}</div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">{{ form.related_order.label_tag }}</div>
                    <div class="col-sm-10">{{ form.related_order }}{{ form.related_order.errors }}</div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">{{ form.salesman.label_tag }}</div>
                    <div class="col-sm-5">{{ form.salesman }}{{ form.salesman.errors }}</div>
                    <div class="col-sm-2 control-label">{{ form.service_state.label_tag }}</div>
                    <div class="col-sm-3">{{ form.service_state }}{{ form.service_state.errors }}</div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">{{ form.remarks.label_tag }}</div>
                    <div class="col-sm-10">{{ form.remarks }}{{ form.remarks.errors }}</div>
                </div>
                <div class="form-group" align="right">
                    <div class="col-sm-12">
                        <button type="submit" class="btn btn-primary" value="Update">{% trans "更新" %}</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}
{% block this_js %}
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-switch.js' %}"></script>
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-select.min.js' %}"></script>
{% endblock %}